#include "DateHelper.h"

DateHelper::DateHelper(QObject *parent)
    : QObject(parent)
{
}

// 获取中文星期
QString DateHelper::getWeekDay()
{
    QDateTime currentDateTime = QDateTime::currentDateTime();
    int dayOfWeek = currentDateTime.date().dayOfWeek();
    
    QStringList weekDays;
    weekDays << "星期一" << "星期二" << "星期三" << "星期四" 
             << "星期五" << "星期六" << "星期日";
    
    // Qt 的 dayOfWeek() 返回 1-7 (1=Monday, 7=Sunday)
    return weekDays[dayOfWeek - 1];
}

// 获取英文星期
QString DateHelper::getWeekDayEnglish()
{
    QDateTime currentDateTime = QDateTime::currentDateTime();
    return currentDateTime.toString("dddd");
}

// 获取星期数字 (1-7)
int DateHelper::getWeekDayNumber()
{
    QDateTime currentDateTime = QDateTime::currentDateTime();
    return currentDateTime.date().dayOfWeek();
}

